package com.sds.sweng.swat.miplatform.ui.design.models.component;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformComponent;
import com.sds.sweng.swat.miplatform.ui.design.utils.CloneUtils;

public class MGrid extends MiplatformComponent {

	public static final int DEFAULT_LINES = 10;

	private List<MColumn> columns;
	private List<MGridHead> gridHeads;
	private List<MGridBody> gridBodys;
	private String bindDataset = StringUtils.EMPTY;
	private int lines = DEFAULT_LINES;
	private boolean autoFit;
	private boolean editable = true;

	public MGrid() {
		columns = new ArrayList<MColumn>();
		gridHeads = new ArrayList<MGridHead>();
		gridBodys = new ArrayList<MGridBody>();
	}

	public MGrid clone() {
		MGrid clone = (MGrid) super.clone();
		clone.setColumns(CloneUtils.clone(columns));
		clone.setGridHeads(CloneUtils.clone(gridHeads));
		clone.setGridBodys(CloneUtils.clone(gridBodys));
		clone.setBindDataset(getBindDataset());
		clone.setLines(getLines());
		clone.setAutoFit(isAutoFit());
		clone.setEditable(isEditable());

		return clone;
	}

	public List<MColumn> getColumns() {
		return columns;
	}

	public void setColumns(List<MColumn> columns) {
		this.columns = columns;
	}

	public List<MGridHead> getGridHeads() {
		return gridHeads;
	}

	public void setGridHeads(List<MGridHead> gridHeads) {
		this.gridHeads = gridHeads;
	}

	public List<MGridBody> getGridBodys() {
		return gridBodys;
	}

	public void setGridBodys(List<MGridBody> gridBodys) {
		this.gridBodys = gridBodys;
	}

	public String getBindDataset() {
		return bindDataset;
	}

	public void setBindDataset(String bindDataset) {
		this.bindDataset = bindDataset;
	}

	public boolean isAutoFit() {
		return autoFit;
	}

	public void setAutoFit(boolean autoFit) {
		this.autoFit = autoFit;
	}

	public boolean isEditable() {
		return editable;
	}

	public void setEditable(boolean editable) {
		this.editable = editable;
	}

	public int getLines() {
		return lines;
	}

	public void setLines(int lines) {
		this.lines = lines;
	}

}
